//
//  AXMyGzTableViewCell.m
//  AnXin100
//
//  Created by 天质弘耕 on 2018/10/17.
//  Copyright © 2018年 tzhg. All rights reserved.
//

#import "AXMyGzTableViewCell.h"
#import "UIView+SDAutoLayout.h"
#import "ZXCategories.h"


@implementation AXMyGzTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self creatView];
        [self setlayout];
    }
    return self;
}

- (void)creatView  {
    /** 用户图像  */
    self.userImgView = [[UIImageView alloc]init];
    /** 图片比例切 */
    self.userImgView.contentMode =UIViewContentModeScaleAspectFill;
    self.userImgView.clipsToBounds=YES;//
    self.userImgView.cornerRadius = 15;
    self.userImgView.image = [UIImage imageNamed:@"xy.jpg"];
    [self.contentView addSubview:self.userImgView];
    /** 用户姓名 */
    self.userNameLabel = [[UILabel alloc]init];
    self.userNameLabel.font = FONT_FOURTEEN;
    self.userNameLabel.textColor = COLOR_Gray;
    self.userNameLabel.text = @"王家大公子";
    [self.contentView addSubview:self.userNameLabel];
    /** 关注 */
    self.attentionButton = [[UIButton alloc]init];
    self.attentionButton.titleLabel.font = FONT_FOURTEEN;
    [self.attentionButton setTitle:@"关注" forState:UIControlStateNormal];
    self.attentionButton.backgroundColor = COLOR_ORG;
    [self.attentionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.contentView addSubview:self.attentionButton];

}

- (void)setlayout {
    /** 用户图像  */
    self.userImgView.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.contentView, 10)
    .widthIs(30)
    .heightIs(30);
    /** 用户名字 */
    self.userNameLabel.sd_layout
    .leftSpaceToView(self.userImgView, 10)
    .centerYEqualToView(self.userImgView)
    .widthIs(100)
    .heightIs(30);
    /** 关注按钮*/
    self.attentionButton.sd_layout
    .rightSpaceToView(self.contentView, 10)
    .topEqualToView(self.userNameLabel)
    .widthRatioToView(self.userNameLabel, 1)
    .heightRatioToView(self.userNameLabel, 1);
    
    
}

@end
